<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>创建射击成绩记录</title> 
<%@ include file="/common/include.jsp" %>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/js/fancybox/jquery.fancybox-1.3.4.css" media="screen" />
<script type="text/javascript" src="${pageContext.request.contextPath}/js/My97DatePicker/WdatePicker.js"></script>
<script>
$(document).ready(function() {
	var status = "${status}";
	if (status.length > 0) {
		if (status == "1") {
			alert("修改成功!");
		} else {
			alert("修改失败!");
		}
		window.location.href="${pageContext.request.contextPath}/page/leaderList.jsp";
	}
});

function materialcreatesubmit() {
	var isValidatestate = true;
	var type_mask = '0';
	var cd_mask = '';
	var page = '1';
	var rows = '15';
	var r = /^[1-9]*[0-9][0-9]*$/; //正整数
	var t = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)([\w-]+\.)+(\S)+$/i;
	var te = /^([\w-]+\.)+(\S)+$/i;
	var a = /select|insert|update|dalete|\'|\/\*|\.\.\/|union|into|load_file|outfile/;
	var name;
	
	name = $("#name").val();
	if(name ==''){
		$("#tp_name").show();
		$("#tp_name").html('姓名不能为空');
		return false;
	}
	$("#tp_name").hide();
	
	name = $("#registerTime").val();
	if(name ==''){
		$("#tp_registerTime").show();
		$("#tp_registerTime").html('注册时间不能为空');
		return false;
	}
	$("#tp_registerTime").hide();
	
	name = $("#sex").val();
	if(name ==''){
		$("#tp_sex").show();
		$("#tp_sex").html('性别不能为空');
		return false;
	}
	$("#tp_sex").hide();
	
	name = $("#level").val();
	if(name ==''){
		$("#tp_level").show();
		$("#tp_level").html('军衔级别不能为空');
		return false;
	}
	$("#tp_level").hide();
	
	name = $("#status").val();
	if(name ==''){
		$("#tp_status").show();
		$("#tp_status").html('跃进距离2不能为空');
		return false;
	}
	$("#tp_status").hide();

	document.getElementById("form").submit();
}

function comeback() {
	window.location="${pageContext.request.contextPath}/page/leaderList.jsp";
}
</script>
</head>

<body>
<div class="wrapper">
	<jsp:include page="/common/header.jsp"><jsp:param value="2" name="nav"/></jsp:include>
	<div class="content" style="">
		<div class="col_l">
			<div class="l_top"></div>
			<div class="l_menu">
			      <jsp:include page="/common/l_info_place.jsp"><jsp:param value="2" name="nav"/></jsp:include>
			</div>
			<div class="l_bottom"></div>
		</div>
		<div class="col_r" style="">
			<div class="guide blue">
				<span class="left">当前位置：<a href="${pageContext.request.contextPath }/page/leaderList.jsp">训练员管理</a> > 编辑</span>
			</div>
			<div class="mx_title">
				<div class="cj_l"></div>
				<div class="cj_c"> 编辑</div>
				<div class="cj_r"></div>
			</div>                
			<form id="form" name="form" action="${pageContext.request.contextPath }/leader/update" method="post">				 
				<div class="cj_con" id="main" style="">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr style="" id='trmaterialname'>
							<td width="14%" height="35" align="right">姓名：</td>
                            <td width="2%" align="center"><div class="star">*</div></td>
                            <td width="84%">
                            	<input type="hidden" id="id" name="id" value="${leader.id }" />
                            	<input type="text" id='name' name="name" width="129px"  value="${leader.name }" class="input_cj left" />                 
                            	<div class="tips_error left" style="display:none;"  id='tp_name'></div>
                             </td>
						</tr>
						<tr style="">
                            <td height="35" align="right">注册时间：</td>
                            <td width="2%" align="center"><div class="star">*</div></td>
                            <td>
								<input  type="text" id="registerTime" name="registerTime" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="Wdate" value="<fmt:formatDate value="${leader.registerTime}" pattern="yyyy-MM-dd"/>"/>
								<div class="tips_error left" style="display:none;"  id='tp_registerTime'></div>
							</td>
						</tr>
						<tr>
							<td height="35" align="right">性别：</td>
							<td align="center"><div class="star">*</div></td>
							<td colspan="2">
								<span class="left">
									<select class="select_1" style="width: 129px" id="sex" name="sex" >
										<option value="1" <c:if test="${leader.sex == 1 }">selected = "selected"</c:if>>男</option>
										<option value="2" <c:if test="${leader.sex == 2 }">selected = "selected"</c:if>>女</option>
									</select>
								</span>
								<div style="display:none;" class="tips_error left" id="tp_sex"></div>
							</td>
						</tr>
						<tr>
							<td height="35" align="right">军衔级别：</td>
							<td align="center"><div class="star">*</div></td>
							<td colspan="2">
								<span class="left">
									<select class="select_1" style="width: 129px" id="level" name="level">
										<option value="1" <c:if test="${leader.level == 1 }">selected = "selected"</c:if>>士官</option>
										<option value="2" <c:if test="${leader.level == 2 }">selected = "selected"</c:if>>少尉</option>
										<option value="3" <c:if test="${leader.level == 3 }">selected = "selected"</c:if>>中尉</option>
										<option value="4" <c:if test="${leader.level == 4 }">selected = "selected"</c:if>>上尉</option>
									</select>
								</span>
								<div style="display:none;" class="tips_error left" id="tp_sex"></div>
							</td>
						</tr>
						<tr>
							<td height="35" align="right">状态：</td>
							<td align="center"><div class="star">*</div></td>
							<td colspan="2">
								<span class="left">
									<select class="select_1" style="width: 129px" id="status" name="status">
										<option value="0" <c:if test="${leader.status == 0 }">selected = "selected"</c:if>>无效</option>
										<option value="1" <c:if test="${leader.status == 1 }">selected = "selected"</c:if>>在职</option>
										<option value="2" <c:if test="${leader.status == 2 }">selected = "selected"</c:if>>已离职</option>
										<option value="3" <c:if test="${leader.status == 3 }">selected = "selected"</c:if>>暂停职务</option>
									</select>
								</span>
								<div style="display:none;" class="tips_error left" id="tp_status"></div>
							</td>
						</tr>
					</table>
					<div style=" margin-left:120px; margin-top:10px;">
						<a href="javascript:void(0)" id='onsubmit'>
							<img onclick="materialcreatesubmit();" src="${pageContext.request.contextPath}/images/over.gif" />
					  	</a>
					    <img onclick='comeback();'src='${pageContext.request.contextPath}/images/formcacle.gif' style="margin-left:15px;cursor:pointer"/>
					</div>
				</div>
			</form> 
		</div>
		 
		   <div class="clear"></div>
		   
	  </div>

<div class=footer>CopyRight &copy;Research Institute of Computer Systems of SCUT. All Rights Reserved
	</div>
</div>
<script>
function showHelp(obj){
var help = document.getElementById("key"+obj).style.display;
document.getElementById("key"+obj).style.display="";

} 

function closeHelp(obj){
var help = document.getElementById("key"+obj).style.display;
document.getElementById("key"+obj).style.display="none";
}
	</script>
</body>
</html>